#!/bin/bash

echo 'TZ'
env-update && source /etc/profile
ls /usr/share/zoneinfo
cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime

echo 'Domain name'
cd /etc
echo "127.0.0.1 mybox.at.myplace mybox localhost" > hosts
sed -i -e 's/HOSTNAME.*/HOSTNAME="mybox"/' conf.d/hostname
echo '(Use defined host name and check)'
hostname mybox
hostname -f

echo 'Install kernel sources'
emerge gentoo-sources
cd /usr/src/linux
make menuconfig
echo 'Install kernel sources -- big MAKE'
make -j2
make modules_install
cp arch/i386/boot/bzImage /boot/kernel

echo 'FSTab'
cd /etc
nano -w fstab
#/dev/sda1   /boot     ext2    noauto,noatime     1 2
#/dev/sda3   /         ext3    noatime            0 1
#/dev/sda2   none      swap    sw                 0 0

echo "Install system tools [syslog-ng vixie-cron]"
emerge syslog-ng vixie-cron
rc-update add syslog-ng default
rc-update add vixie-cron default
echo "Install system tools [ppp]"
emerge ppp

echo "Install system tools [grub]"
emerge grub
nano -w /boot/grub/grub.conf
#default 0
#timeout 10
#title Gentoo
#root (hd0,0)
#kernel /boot/kernel root=/dev/sda3
grub
#root (hd0,0)
# Filesystem type is ext2fs, partition type 0xfd
#grub> setup (hd0)
# Checking if "/boot/grub/stage1" exists... yes
# Checking if "/boot/grub/stage2" exists... yes
# Checking if "/boot/grub/e2fs_stage1_5" exists... yes
# Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  16 sectors are embedded.
#succeeded
# Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/boot/grub/stage2 /boot/
#grub/menu.lst"... succeeded
#Done.
#grub> quit


echo 'exit \t\t\tnow'

